import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    redirect: '/login',
  },
  {
    // 登陆页面
    path: '/login',
    component: () => import('../views/Login'),
  },
  {
    // 后台管理首页
    path: '/index',
    name: 'index',
    component: () => import('../views/Main'),
    children: [
      {
        // 新增用户
        path: '/addUser',
        component: () => import('../views/AddUser')
      },
      {
        // 用户列表
        path: '/users',
        component: () => import('../views/Users')
      }
    ]
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
